﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ImageAppDataModels;
using System.IO;
using BrainTechLLC.ThreadSafeObjects;
using WpfImageDuplicates.WCFDataService;

namespace WpfImageDuplicates
{
    public class ServiceDataProvider : ICoreDataProvider
    {
        // public ThreadSafeLookupOnDemand<string, FileImageDto> FileImages = new ThreadSafeLookupOnDemand<string, FileImageDto>();
        public DataServiceClient _Client;

        public ServiceDataProvider()
        {
            _Client = new DataServiceClient();
        }

        //public FileImageDto GetDtoForFile(string fileName)
        //{
        //    return FileImages.Get(fileName, s => new FileImageDto() { FileName = fileName });
        //}

        public byte[] ReadAllImageBytes(string fileName)
        {            
            return _Client.ReadAllImageBytes(fileName);
        }

        public byte[] ReadAllThumbnailBytes(string fileName)
        {         
            return _Client.ReadAllThumbnailBytes(fileName);
        }

        public void WriteAllBytes(string fileName, byte[] bytes)
        {         
            _Client.WriteAllBytes(fileName, bytes);
        }

        public void Copy(string orig, string newFileName)
        {         
            _Client.Copy(orig, newFileName);
        }

        public void Move(string orig, string newFileName)
        {
            _Client.Move(orig, newFileName);
        }

        public void Delete(string fileName)
        {
            _Client.Delete(fileName);
        }

        public bool Exists(string fileName)
        {         
            return _Client.Exists(fileName);
        }

        public void SetAttributes(string fileName, FileAttributes attribs)
        {
            _Client.SetAttributes(fileName, attribs);
        }
    }
}
